using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BHXH.LinqRepository
{
    public class KienNghiRepository : Repository<KienNghi>
    {
      
        public KienNghi GetByPhieuID_MaCau_MaCap1_MaCap2(Guid phieuID, int maCau, string maCap1, string maCap2)
        {
            return dataContext.KienNghis.Where(c => c.PhieuID == phieuID && c.MaCau == maCau
                && (string.IsNullOrEmpty(maCap1) || c.MaCap1 == maCap1)
                && (string.IsNullOrEmpty(maCap2) || c.MaCap2 == maCap2)).FirstOrDefault();

        }
        public void InsertOne(KienNghi one)
        {
            one.ID = Guid.NewGuid();
           // Add(one);
            dataContext.KienNghis.InsertOnSubmit(one);
        }
        public void EditOne(KienNghi one)
        {
            //dataContext.KienNghis.Attach(one, true);
            //Update(one);
        }
    }
}
